<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../../day08/js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<input type="text<br />" name="" id="" value="" />
		<ul>			
		</ul>
	</body>
	<script type="text/javascript">
		$("input").keyup(function(){
//?&&&&&		
			$.ajax({
				type:'get',
				url:"https://sug.so.360.cn/suggest",
				dataType:'jsonp',
				data:{
					callback:'suggest_so',
					encodein:'utf-8',
					encodein:'utf-8',
					encodeout:'utf-8',
					format:'json',
					fields:'word',
					word:$(this).val(),
				},
				success:function(resp){
					//清楚之前的数据
					$("ul").html('')
					for (var i = 0; i < resp.result.length; i++) {						
						console.log(resp.result[i].word)
						$("ul").append('<li>'+resp.result[i].word+'</li>')
					}
					
				},
				error:function(){
					alert("失败")
				}
			});
//			.done(function(resp){
//				alert("chenggong")
//			})
//			.fail(function(){
//				alert("shibai")
//			});
		})				
	</script>
</html>
